/*

 * @(#)XlsTData.java

 */

package com.stony.poie.basic;

import com.stony.poie.ext.XlsStyle;

/**
 * Externally looking, a XlsTData is respond to a cell in a sheet; internally
 * looking, a XlsTData is the elementary XlsUnit that can NOT contain other
 * XlsUnit or collection/array, so its getXlsContents() method returns null.
 * <p>
 * Last modified: February 14, 2006
 * 
 * @author Thomas Wu
 * @version 1.0.1
 */

public final class XlsTData implements XlsUnit {

	/* Value stored in the XlsTData. */

	private Object value;

	/* Style of the XlsTData. */

	private XlsStyle style;

	/* Column span of the XlsTData. */

	private int colspan;

	/* Row span of the XlsTData. */

	private int rowspan;

	/* Index of style in XlsFile. */

	private int styleIndex;

	/* Wheather value (string type) of the XlsTData is a formula or not. */

	private boolean isFormula;

	/**
	 * Construct a new XlsTData instance.
	 * 
	 * @param value
	 *            value content of the XlsTData
	 * @param colspan
	 *            column span of the XlsTData
	 * @param rowspan
	 *            row span of the XlsTData
	 * @param styleIndex
	 *            index of style in XlsFile
	 * @param isFormula
	 *            style information of the XlsTData, eg. alignment, font,
	 *            border...
	 * 
	 */

	public XlsTData(Object value, int colspan, int rowspan,

	int styleIndex, boolean isFormula) {

		this.value = value;

		this.styleIndex = styleIndex;

		this.colspan = colspan;

		this.rowspan = rowspan;

		this.isFormula = isFormula;

	}

	/** Overloaded Constructor. */

	public XlsTData(Object value, int colspan, int rowspan, int styleIndex) {

		this(value, colspan, rowspan, styleIndex, false);

	}

	/** Overloaded Constructor. */

	public XlsTData(Object value, int colspan, int rowspan) {

		this(value, colspan, rowspan, XlsFile.CUSTOM_STYLES_NUM, false);

	}

	/** Overloaded Constructor. */

	public XlsTData(Object value, int styleIndex) {

		this(value, 1, 1, styleIndex, false);

	}

	public XlsTData(Object value, boolean isFormula) {

		this(value, 1, 1, XlsFile.CUSTOM_STYLES_NUM, true);

	}

	/** Overloaded Constructor. */

	public XlsTData(Object value) {

		this(value, 1, 1, XlsFile.CUSTOM_STYLES_NUM, false);

	}

	/** Overloaded Constructor. */

	public XlsTData() {

		this("", 1, 1, XlsFile.CUSTOM_STYLES_NUM, false);

	}

	/**
	 * 
	 * @return value stored in the XlsTData.
	 * 
	 */

	public Object getValue() {

		return value;

	}

	/**
	 * 
	 * @param value
	 *            value stored in the XlsTData.
	 * 
	 */

	public void setValue(Object value) {

		this.value = value;

	}

	/**
	 * 
	 * @return style of the XlsTData.
	 * 
	 */

	public XlsStyle getStyle() {

		return style;

	}

	/**
	 * 
	 * @param style
	 *            style of the XlsTData.
	 * 
	 */

	public void setStyle(XlsStyle style) {

		this.style = style;

	}

	/**
	 * 
	 * @return column span of the XlsTData.
	 * 
	 */

	public int getColspan() {

		return colspan;

	}

	/**
	 * 
	 * @param colspan
	 *            column span of the XlsTData.
	 * 
	 */

	public void setColspan(int colspan) {

		this.colspan = colspan;

	}

	/**
	 * 
	 * @return row span of the XlsTData.
	 * 
	 */

	public int getRowspan() {

		return rowspan;

	}

	/**
	 * 
	 * @param rowspan
	 *            row span of the XlsTData.
	 * 
	 */

	public void setRowspan(int rowspan) {

		this.rowspan = rowspan;

	}

	/**
	 * 
	 * @return index of style in XlsFile.
	 * 
	 */

	public int getStyleIndex() {

		return styleIndex;

	}

	/**
	 * 
	 * @param styleIndex
	 *            index of style in XlsFile.
	 * 
	 */

	public void setStyleIndex(int styleIndex) {

		this.styleIndex = styleIndex;

	}

	/**
	 * 
	 * @return wheather value (string type) of the XlsTData
	 * 
	 * is a formula or not.
	 * 
	 */

	public boolean isFormula() {

		return isFormula;

	}

	/**
	 * 
	 * @param isFormula
	 *            wheather value (string type) of the XlsTData
	 * 
	 * is a formula or not.
	 * 
	 */

	public void setIsFormula(boolean isFormula) {

		this.isFormula = isFormula;

	}

	/**
	 * 
	 * A XlsTData is the elementary XlsUnit that can NOT
	 * 
	 * contain any other XlsUnit or collection/array, so
	 * 
	 * its getContents() method returns null.
	 * 
	 */

	public Object[] getXlsContents() {

		return null;

	}

}
